import Vue from 'vue'
import VueRouter from 'vue-router'


const AdminDashboard = () => import( 'src/components/admin/home/Dashboard.vue');

const AdminCustomerMain = () => import( 'src/components/admin/customer/Main.vue');

const AdminCustomer = () => import( 'src/components/admin/customer/HCustomer.vue');

const AdminCreateCustomer = () => import( 'src/components/admin/customer/CreateCustomer');
//订单管理

const AdminOrdersMain = () => import( 'src/components/admin/orders/Main.vue');
const AdminOrder = () => import( 'src/components/admin/orders/Order.vue');
const AdminOrderDebet = () => import( 'src/components/admin/orders/Debet.vue');
const AdminOrderRefund = () => import( 'src/components/admin/orders/Refund.vue');
const AdminOrderRename = () => import( 'src/components/admin/orders/Rename.vue');
//采购管理
const AdminPurchaseMain = () => import( 'src/components/admin/purchase/Main.vue');
const AdminPurchases = () => import( 'src/components/admin/purchase/Purchase.vue');
const AdminPurchaseEdit = () => import( 'src/components/admin/purchase/components/PurchaseEdit');
const AdminPurchaseDetail = () => import( 'src/components/admin/purchase/components/PurchaseDetail');
const AdminPurchaseDetailEdit = () => import( 'src/components/admin/purchase/components/PurchaseDetailEdit');
const AdminDispatchsMain = () => import( 'src/components/admin/dispath/DispathMain.vue');

const AdminDispatch = () => import( 'src/components/admin/dispath/Dispatch.vue');
const AdminDispathed = () => import( 'src/components/admin/dispath/Dispatched.vue');
//系统管理
const AdminSystemMain = () => import( 'src/components/admin/system/Main.vue');
const AdminSystem = () => import( 'src/components/admin/system/System.vue');
const AdminSystemAdmin = () => import( 'src/components/admin/system/Admin.vue');
const AdminSystemTruch = () => import( 'src/components/admin/system/Truck.vue');
const AdminOpenAuth = () => import( 'src/components/admin/system/OpenAuth.vue');
const AdminDistrict = () => import( 'src/components/admin/system/District');
const AdminGrade = () => import( 'src/components/admin/system/Grade');
const AdminMailTemplate = () => import( 'src/components/admin/system/MailTemplate');
const AdminMailTemplateEdit = () => import( 'src/components/admin/system/MailTemplateEdit');
//商品管理
const AdminGoodsMain = () => import( 'src/components/admin/goods/Main.vue');
const AdminGoods = () => import( 'src/components/admin/goods/Goods.vue');
const CreateAmindGood = () => import( 'src/components/admin/goods/components/CreateGood');
const AdminGoodsBrand = () => import( 'src/components/admin/goods/Brand.vue');
const AdminCreateBrand = () => import( 'src/components/admin/goods/components/CreateBrand');

const AdminGoodsCategory = () => import('src/components/admin/goods/Category.vue');
const AdminCreateCategory = () => import( 'src/components/admin/goods/components/CreateCategory');

const AdminSpec = () => import('src/components/admin/goods/Spec');
const AdminSupply = () => import('src/components/admin/goods/Supply');
const MainPage = () => import('src/components/admin/layout/MainPage');
const Login = () => import('src/components/admin/public/Login');
const Page404 = () => import('src/components/shop/pages/Page404');
const AdminImportData = () => import('src/components/admin/system/ImportData')
const AdminInvitation = () => import("src/components/admin/system/Invitation")

Vue.use(VueRouter);

export default new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/admin/index.html',
      name: '首页',
      component: MainPage,
      redirect: '/admin/dashboard.html',
      children: [
        {
          path: '/admin/dashboard.html',
          name: 'Dashboard',
          component: AdminDashboard
        },
        {
          path: '/admin/customer.html',
          name: '客户管理',
          component: AdminCustomerMain,
          redirect: '/admin/customer/customers.html',
          children: [
            {
              path: '/admin/customer/customers.html',
              name: '客户信息',
              component: AdminCustomer
            },
            {
              path: '/admin/customer/create.html',
              name: '创建用户',
              component: AdminCreateCustomer
            }
          ]
        },

        {
          path: '/admin/goods.html',
          name: '商品管理',
          component: AdminGoodsMain,
          redirect: '/admin/goods/goods.html',
          children: [
            {
              path: '/admin/goods/goods.html',
              name: '商品列表',
              component: AdminGoods
            },
            {
              path: '/admin/goods/good/create.html',
              name: '添加商品',
              component: CreateAmindGood
            },
            {
              path: '/admin/goods/brand.html',
              name: '商品品牌',
              component: AdminGoodsBrand
            },
            {
              path: '/admin/goods/brand/create.html',
              name: '添加品牌',
              component: AdminCreateBrand
            },
            {
              path: '/admin/goods/brand/:id/edit.html',
              name: '编辑品牌',
              component: AdminCreateBrand
            },

            {
              path: '/admin/goods/category.html',
              name: '商品分类',
              component: AdminGoodsCategory
            },
            {
              path: '/admin/goods/category/create.html',
              name: '添加分类',
              component: AdminCreateCategory
            },
            {
              name: '规格管理',
              path: '/admin/goods/spec.html',
              component: AdminSpec
            },
            {
              name: '供应商管理',
              path: '/admin/goods/supply.html',
              component: AdminSupply
            }
          ]
        },
        {
          path: '/admin/dispatch.html',
          name: '发货管理',
          component: AdminDispatchsMain,
          redirect: '/admin/dispatch/todo.html',
          children: [
            {
              path: '/admin/dispatch/todo.html',
              name: '待发列表',
              component: AdminDispatch
            },
            {
              path: '/admin/dispath/done.html',
              name: '已发列表',
              component: AdminDispathed
            }
          ]
        },
        {
          path: '/admin/order.html',
          name: '订单管理',
          component: AdminOrdersMain,
          redirect: '/admin/order/orders.html',
          children: [
            {
              path: '/admin/order/orders.html',
              name: '订单信息',
              component: AdminOrder
            },
            {
              path: '/admin/order/debet.html',
              name: '欠款信息',
              component: AdminOrderDebet
            },
            {
              path: '/admin/order/refund.html',
              name: '退款信息',
              component: AdminOrderRefund
            }, {
              path: '/admin/order/rename.html',
              name: '更名信息',
              component: AdminOrderRename
            }

          ]
        }, {
          path: '/admin/purchase.html',
          name: '采购管理',
          component: AdminPurchaseMain,
          redirect: '/admin/purchase/purchases.html',
          children: [
            {
              path: '/admin/purchase/purchases.html',
              name: '采购信息',
              component: AdminPurchases,
              children: [
                {
                  path: '/admin/purchase/purchases/:id/create.html',
                  name: '添加采购单',
                  component: AdminPurchaseEdit,
                  meta: {type: 'create'}
                },
                {
                  path: '/admin/purchase/purchases/:id/edit.html',
                  name: '编辑采购单',
                  component: AdminPurchaseEdit,
                  meta: {type: 'edit'}
                },

                {
                  path: '/admin/purchase/puchasedetail/:id/create.html',
                  name: '添加采购详情',
                  component: AdminPurchaseDetailEdit,
                  meta: {type: 'create'}
                },
                {
                  path: '/admin/purchase/puchasedetail/:id/edit.html',
                  name: '编辑采购详情',
                  component: AdminPurchaseDetailEdit,
                  meta: {type: 'edit'}
                },
                {
                  path: '/admin/purchase/purchases/:id/detail.html',
                  name: '订单详情',
                  component: AdminPurchaseDetail
                },

              ]
            }
          ]
        }, {
          path: '/admin/system.html',
          name: '系统管理',
          component: AdminSystemMain,
          redirect: '/admin/system/config.html',
          children: [
            {
              path: '/admin/system/config.html',
              name: '系统配置',
              component: AdminSystem
            },
            {
              path: '/admin/system/admin.html',
              name: '管理员管理',
              component: AdminSystemAdmin
            }, {
              path: '/admin/system/truck.html',
              name: '快递管理',
              component: AdminSystemTruch
            }, {
              path: '/admin/system/openauth.html',
              name: '第三方登录',
              component: AdminOpenAuth
            }, {
              path: '/admin/system/district.html',
              name: '地区管理',
              component: AdminDistrict
            }, {
              path: '/admin/system/grade.html',
              name: '等级管理',
              component: AdminGrade
            }, {
              path: '/admin/system/mailtemplate.html',
              name: '邮件模版',
              component: AdminMailTemplate
            }, {
              path: '/admin/system/mailtemplate/:id/edit.html',
              name: '编辑邮件模版',
              component: AdminMailTemplateEdit
            }, {
              path: '/admin/system/importdata.html',
              name: '数据导入',
              component: AdminImportData
            }, {
              path: '/admin/system/invitation.html',
              name: '验证码管理',
              component: AdminInvitation
            }
          ]
        }
      ]
    }, {
      path: '/admin/login.html',
      name: '管理员登录',
      component: Login
    },
    {
      path: '*',
      name: '404页面',
      component: Page404
    }
  ]
})
